package com.account.mapper;


import com.entity.Account;
import com.entity.Authority;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface AccountMapper {

    public Account login(Account account);

    public Account loginByUserName(String username);

    //根据用户名取得用户权限
    @Select(value = "select a.* from t_customer c,t_authority a,t_customer_authority ca where ca.customer_id=c.id and ca" +
            ".authority_id=a.id and c.username =#{username}")
    public List<Authority> findAuthoritiesByUsername(String username);

    public List<Account> getAccountList(String username);

    @Update("update t_customer set avatar=#{avatar} where id=#{id}")
    public int uploadAvatar(Account account);
}
